import App from './App'
import uviewPlus from '@/uni_modules/uview-plus'
import config from '@/utils/config'
import shareMixin from '@/utils/shareMixin'
import Store from './store'
import * as Foundation from '@/utils/Foundation.js'
import { hidePhoneNum,hideCardNum,formatDate,formatDistance,formatPrice,oosImgZip,formatTimeAgo } from '@/utils/filters.ts'
// #ifdef H5
import "@/static/js/uni.webview.1.5.4.js"
// #endif


import { createSSRApp } from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	app.config.globalProperties.$Foundation = Foundation
	app.config.globalProperties.$imgUrl = config.imgUrl
	app.config.globalProperties.$isLogin = uni.getStorageSync('userPhone');
	
	// 添加全局filter
	app.config.globalProperties.$filters = {
		hidePhoneNum,hideCardNum,formatDate,formatDistance,formatPrice,oosImgZip,formatTimeAgo
	}
	// #ifdef H5
	document.addEventListener('UniAppJSBridgeReady', function() {
		app.config.globalProperties.$uni=uni.webView;
	})
	// #endif
	app.mixin(shareMixin)
	app.use(uviewPlus).use(Store)
	return {
		app
	}
}
